
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
  </head>
  <body>
    <h1>webwork示例</h1>
    <script>
      if(Worker){
          console.log(Worker);
          var w;
          if(!w){
            w = new Worker('./webworker.js')
            w.postMessage("测试")
          }
          w.onmessage = function(e){
            console.log('父进程收到：',e.data)
          }
      }else{
        console.log('浏览器不支持');
      }
    </script>
  </body>
</html>